home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c
- Subject: Re: Array Parameters
- Date: 04 Jan 1996 20:06:49 GMT
- Organization: Computer People Inc.
- Message-ID: <ALUN.CHAMPION.96Jan4150649@g7240065.bridge.bst.bls.com>
- References: <wayne.820650643@hawk> <4ce349$4j9@hacgate2.hac.com>
- <820701694snz@genesis.demon.co.uk> <4cg104$qmp@nervous.pdb.sni.de>
- <4cgmuc$k9k@hacgate2.hac.com>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: collins@thor.tu.hac.com's message of 4 Jan 1996 14:07:08 GMT
-
- In article <4cgmuc$k9k@hacgate2.hac.com> collins@thor.tu.hac.com (Ron Collins) writes:
-
- : Josef Moellers (mollers.pad@sni.de) wrote:
- : : In <820701694snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
-
- :: [ ... ]
- ::> It is impossible
- ::> to specify an array as a function parameter since, as in the example above,
-
- :: Well, if you MUST pass an array by value and not by reference, wrap it
- :: into a structure:
-
- :: struct foo {
- :: int array[100];
- :: };
- :: ...
-
- : I don't get it ... what does this buy me ("me" == any competant C programmer)?
- : I'm still going to get a pointer-to-something, whether it's a pointer-to-
- : structure, pointer-to-array, or pointer-to-first-element. I still need to
- : know which one is used so I can access the array elements properly. (Although,
- : there is seldom any difference between passing a pointer to an array, and
- : a pointer to the first element of that array).
-
- In 'C' you can pass structures by value, this includes all the contents of
- that structure. So it gets you ("you" == any competent C programmer ;') what you
- require, if you require the array by value - with the cost of accessing the
- array through a structure. Personally I would refrain from such practices
- because I feel they are (the big technical word of the day) icky!
-
- : BTW, passing a pointer to an object is _not_ the same as pass by reference.
- : C does not support pass-by-reference at all.
-
- True, very true - I think what he wrote was a case of quick fingers and slow
- thoughts, and not true misunderstanding. ;')
-
- Regards
-
- -A.
- --
- | A.Champion |
-